package org.dtrd.modules.system.entity.po;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.system.entity.bean.qiyeweixin.RobotDetail;

import java.util.Date;


/**
 * <p>
 * 企业微信机器人记录表
 * </p>
 *
 * @author QR
 * @since 2022-03-08
 */
@Getter
@Setter
@TableName("dtrd_ent_rd_robot")
public class DtrdEntRdRobot {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    /**
     * 机器人名字
     */
    @TableField("robot_name")
    private String robotName;

    /**
     * 机器人webhookurl
     */
    @TableField("webhookurl")
    private String webhookurl;

    /**
     * webhook中的key
     */
    @TableField("webhookkey")
    private String webhookkey;

    /**
     * 机器人的创建人
     */
    @TableField("create_by")
    private String createBy;

    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    @TableField("create_time")
    private Date createTime;

    public DtrdEntRdRobot init() {
        isDel = 0;
        createTime = new Date();
        return this;
    }

    public DtrdEntRdRobot parseFromDTO(RobotDetail dto) {
        dataId = dto.getId();
        robotName = dto.getRobotName();
        webhookurl = dto.getWebhookurl();
        return this;
    }


}
